Skip to content

Comments

Added a catch block to the pushWithReply expression to handle uncaught promise timeout error#3760

Closed
Harrison1 wants to merge 1 commit intophoenixframework:mainfrom
Harrison1:pushinput-pushwithreply-catch
Closed

Added a catch block to the pushWithReply expression to handle uncaught promise timeout error#3760
Harrison1 wants to merge 1 commit intophoenixframework:mainfrom
Harrison1:pushinput-pushwithreply-catch

Conversation

@Harrison1
Copy link

Added a catch block to the this.pushWithReply function inside pushInput to handle an Uncaught (in promise) {timeout: true} error.

The motivation is to handle the uncaught promise error thrown inside view.js usually thrown in idle tabs. In a production app we're seeing a lot of Uncaught (in promise) {timeout: true} errors thrown in the console with Sentry reporting a UnhandledRejection: Object captured as promise rejection with keys: timeout. We've typically noticed this error when a user's tab goes idle , either through inactivity or on mobile through switching apps or closing their device for an extended period of time.

Browser Error

plv-viewjs-console-error-uncaught-timeout

Browser view.js Trace

plv-viewjs-error-highlight

SteffenDE added a commit that referenced this pull request Apr 16, 2025
#3443
changed the pushWithReply function to use promises instead. Previously,
if we did not handle the timeout, it was just ignored, but now we reject
the promise, which will cause unhandled promise rejections.

This PR adds catch clauses to all cases where we previously did not handle
the timeout. At the moment, these log an error, but we can also silently
drop if we want. cc @chrismccord

Supersedes #3760.
@SteffenDE
Copy link
Collaborator

Thank you @Harrison1!

I think we should actually do this in more places, so closing this in favor of #3763.

@SteffenDE SteffenDE closed this Apr 16, 2025
@Harrison1
Copy link
Author

Thank you @Harrison1!

I think we should actually do this in more places, so closing this in favor of #3763.

Thank you @SteffenDE ,

Absolutely, I totally agree, thanks so much, your PR looks great.

SteffenDE added a commit that referenced this pull request Apr 16, 2025
#3443
changed the pushWithReply function to use promises instead. Previously,
if we did not handle the timeout, it was just ignored, but now we reject
the promise, which will cause unhandled promise rejections.

This PR adds catch clauses to all cases where we previously did not handle
the timeout. At the moment, these log an error, but we can also silently
drop if we want. cc @chrismccord

Supersedes #3760.
SteffenDE added a commit that referenced this pull request Apr 16, 2025
#3443
changed the pushWithReply function to use promises instead. Previously,
if we did not handle the timeout, it was just ignored, but now we reject
the promise, which will cause unhandled promise rejections.

This PR adds catch clauses to all cases where we previously did not handle
the timeout. At the moment, these log an error, but we can also silently
drop if we want. cc @chrismccord

Supersedes #3760.
SteffenDE added a commit that referenced this pull request Apr 16, 2025
#3443
changed the pushWithReply function to use promises instead. Previously,
if we did not handle the timeout, it was just ignored, but now we reject
the promise, which will cause unhandled promise rejections.

This PR adds catch clauses to all cases where we previously did not handle
the timeout. At the moment, these log an error, but we can also silently
drop if we want. cc @chrismccord

Supersedes #3760.
SteffenDE added a commit that referenced this pull request Apr 16, 2025
* Catch promise rejections from pushWithReply

#3443
changed the pushWithReply function to use promises instead. Previously,
if we did not handle the timeout, it was just ignored, but now we reject
the promise, which will cause unhandled promise rejections.

This PR adds catch clauses to all cases where we previously did not handle
the timeout. At the moment, these log an error, but we can also silently
drop if we want. cc @chrismccord

Supersedes #3760.

* don't catch for pushHookEvent
SteffenDE added a commit that referenced this pull request Apr 16, 2025
#3443
changed the pushWithReply function to use promises instead. Previously,
if we did not handle the timeout, it was just ignored, but now we reject
the promise, which will cause unhandled promise rejections.

This PR adds catch clauses to all cases where we previously did not handle
the timeout. At the moment, these log an error, but we can also silently
drop if we want. cc @chrismccord

Supersedes #3760.
SteffenDE added a commit that referenced this pull request Apr 16, 2025
* Catch promise rejections from pushWithReply

#3443
changed the pushWithReply function to use promises instead. Previously,
if we did not handle the timeout, it was just ignored, but now we reject
the promise, which will cause unhandled promise rejections.

This PR adds catch clauses to all cases where we previously did not handle
the timeout. At the moment, these log an error, but we can also silently
drop if we want. cc @chrismccord

Supersedes #3760.

* don't catch for pushHookEvent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants